<?php
/**
* +---------------------------------------------------------------------------+
* | $Id: fqdnlist.php 37 2005-04-03 05:54:36Z vluther $ 												|
* +---------------------------------------------------------------------------+
* | $Rev: 37 $ 																																|
* +---------------------------------------------------------------------------+
* | Copyright (c) 2002-2004 Linuxpowered, Inc 																|
* +---------------------------------------------------------------------------+
* | Author: Vidyut Luther 																										|
* +---------------------------------------------------------------------------+
*
* $URL: http://svn.linuxpowered.com/binder/admin/fqdnlist.php $
**/
$section = "ADMIN";
$title = "Binder: List of Domains "; 
 
require_once '../global.inc.php'; 
require_once INCLUDE_PATH . '/USER.class.php'; 
require_once INCLUDE_PATH . '/FQDN.class.php'; 

#$dom =& new FQDN(); 
#$dom =& $dom ; 


$userlevel = $_SESSION['userlevel']; 
$curuser = $_SESSION['USERID']; 


$action = $_GET['action'];
$domid = $_GET['id']; 
 
if($action == 'delete') {
  $dom->removeDomain($domid); 
  $loc = WEB_BASE . "admin/fqdnlist.php"; 
  header("Location: $loc"); 
}


if($userlevel  == "0") {
  $arrDoms = $dom->fqdnList($curuser=NULL,$searchval);
} else {
  $arrDoms = $dom->fqdnList($curuser,$searchval); 
}
#} else {
#	$arrDoms = $dom->fqdnList(null,$searchval);
#}


if(!empty($_GET['foruser'])) {
	unset($arrDoms); 
	$foruser = $_GET['foruser'];
  $tpl->assign("foruser",$foruser); 	
	// Check to make sure the user is not trying to view list for a user he doesn't 
	// have privileges to. (No changing the query string by hand here. 
	// Eventually we'll give a nicer message . 
	if(($userlevel != 0) && ($foruser != $curuser)) {
		echo "You do not have the proper permissions<br> "; 
		die; 
	}
	$arrDoms = $dom->fqdnList($foruser,$searchval);
}







$tpl->assign("domains",$arrDoms); 
$tpl->assign("mode","modify"); 

$tpl->display('domlist.html'); 
?>
